<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta property="wb:webmaster" content="72818d890429100a" />
<meta property="qc:admins" content="0630466060113453463452757665701136375" />
<meta property="wb:webmaster" content="72818d890429100a" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="后端即服务 MoPaaS 魔泊网 平台即服务 中立云平台 开放云平台 应用生命周期 应用部署 应用运维 应用引擎 PaaS App Engine 移动应用 推送 云存储 PHP JAVA 运行平台 运行环境 " />
<meta name="description" content="MoPaaS作为一个开放、敏捷、安全、可扩充的智能化云计算平台服务，可以使得用户可以快捷地部署和弹性扩展应用，在线监控和管理应用的运行，极大地减少应用部署、升级、扩展和运维时间和成本。特别是信息链云管理的数据平台技术提供安全的智能化应用环境，MoPaaS避免对应用和服务的锁定，广泛地支持大多数的应用开发语言、框架和服务，特别是平台提供包括推送、社交、地理信息等移动服务，同时开发者不必锁定特定的云计算服务供应商。" />
	<title>应用首页</title>
	<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"/>
	<link rel="stylesheet" type="text/css" href="/css/admin.css" media="all" />
	<link rel="stylesheet" type="text/css" href="/css/wcheng.css" media="all" />
	<link rel="stylesheet" type="text/css" href="/css/master.css" media="all" />
	<link rel="stylesheet" type="text/css" href="/css/listapp.css" media="all" />
	<link rel="stylesheet" type="text/css" href="/css/code.css" media="all" />
	<link rel="stylesheet" type="text/css" href="/css/delApp.css" media="all" />
	<link rel="stylesheet" type="text/css" href="/css/upgrade.css" media="all" />
	<link rel="stylesheet" type="text/css" href="/css/domain.css" media="all" />
	<link rel="stylesheet" type="text/css" href="/css/jquery-ui-1.8.18.custom.css" media="all"></link>
	<script type="text/javascript" src="/js/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="/js/jquery.cookie.js"></script>
	<script type="text/javascript" src="/js/jquery-ui-1.8.18.custom.min.js"></script>
	<script type="text/javascript" src="/js/app.js"></script>
	<script type="text/javascript" src="/js/form.js"></script>
	<script type="text/javascript">
 		var token = getCookie("token");
 		if(token == "" || token == null)
		{
			alert('请先登录');
			location.href = "../login.jsp";
		}
 	</script>
</head>

<body>

<!-- 提示框  -->
<div id="messageBox" style="display:none">
<p id="messageContent" style="margin-top:5px"></p>
</div>

<!--顶部-->
<div class="header">
    <div class="header_2">
		 <div class="home_logo">
		     <img src="../images/mopaas_pice/logo_zh-CN.png" onclick="location.href='../portal.jsp';"/></img>
		</div>
		 <div class="home_header_title">
			<div class="home_header_title_1"><a href="/app/listApp.jsp" class="bar_title">应用列表</a></div>
			<div class="home_header_title_1"><a href="/service/listService.jsp" class="bar_title">全部服务</a></div>
			<div class="home_header_title_1"><a href="/shop/appShop.jsp" class="bar_title">应用商店</a></div>
			<div class="home_header_title_1"><a href="/user/upgrade.jsp" class="bar_title">套餐管理</a></div>
			<div class="home_header_title_1"><a id="helpdocs" class="bar_title" style="cursor:pointer" href="http://helpdocs.sturgeon.mopaas.com/helpdocs/index.html" target="_blank">文档中心</a></div>
			<div class="home_header_title_1"><a id="homeforum" class="bar_title" style="cursor:pointer" href="http://forum.mopaas.com" target="_blank">论坛</a></div>
		 </div>
		 <div class="right">
		 	<div class="left">
		 		<div class="left">
		 			<img id="remind_img" src="../images/haveNoMessage.png" class="header_remind_img"   onclick="document.location.href='../user/remind.jsp'" />   <!--  onclick="document.location.href='../user/remind.jsp'" onclick="remindInMaintenance()"   -->
		 		</div>
		 		<div style="position:relative;">
		 			<div class="remind_img_num_absolute">
		 				<span id="remind_img_num"></span>	
		 			</div>
		 		</div>
		 	</div>
		 	<div id="login_info" class="user_list">
         	  <div id="userInfo" class="user_list_name">
         	  		<div class="user_list_name_icon"></div>
					<div id="email" class="user_list_name_text"></div>
			   </div>
			   <div class="clear"></div>
			   <div id="operate_list" style="display:none;position:relative;">		 	
			   	<div class="user_info_operate_list_absolult" style="z-index:10">
					<!-- <div onclick="document.location.href='../user/user_info.jsp'">个人信息</div> -->
		 	  		<div onclick="window.location.href='../user/my_coupons.jsp'">我的优惠</div>
		 	  		<div onclick="window.location.href='../user/payment_list.jsp'">支付详细</div> 
		 	  		<div onclick="window.location.href='../user/edit_password.jsp'">修改密码</div> 
		 	  		<div onclick="checkSMSauthor()">短信服务</div>
		 	  		<div id="logout">退出登录</div>
			   	</div>	   	
			   </div>
			 </div>
		 </div>
	</div>		
</div>
<script>


</script>


<link rel="stylesheet" type="text/css" href="../css/servicemanage.css" media="all" />
					<div class="managemen_column">
					<!-- 用户登录信息  显示在头部 -->
						<div id="appId" style="display:none"></div>
						<div id="appState" style="display:none"></div>
						<div id="serviceCount" style="display:none"></div>
						<div class="left">
						   <div class="appinfo_1_1icon_inside">
						   		<img src="../images/mopaas_pice/icon-php.png">
						   </div>
							<div class="appinfo_1_1url">
								<a href="http://www.mopaas.com" target="_blank">AppName</a>
							</div>
							<div id="app_switch" class="managemen_switch">
							</div>
						</div>
						<div id="manage_ins_mem" style="padding-left:10px;">
								<!-- 管理内存 -->
								<div id="hide_app_mem" style="display:none"></div>
								<div class="managemen_menory" style="padding-left:30px;">
									<div style="float:left;color: #000;">应用内存</div>
									<div style="float:left;width:200px;" id="managemen_menory_size"><label id="display_mem_num_show" style="float:right;width:150px;text-align: left;font-size:13px;"></label></div>
									<div class="clear"></div>
									<div class="progress_back" style="float:left;">
										<div class="progress" style="width:200px;position:relative;top:0px;">
											<span id="total_mem" class="none" style="width:0%;position:absolute;z-index:5;"></span>
											<span id="fix_total_mem" class="none" style="width:0%;position:absolute;z-index:3;"></span>
											<label id="display_mem_num" style="visibility:hidden;position:absolute;"></label>
			    						</div>
		    						</div>
		    						<div class="managemen_menory_set"></div>
		    						<div class="clear"></div>
		    					</div>
		    					<div class="cpu_contorl" style="display:none;right:0;top:145px;border:1px solid #09f;border-radius: 4px;border-top:0;padding-left:20px;overflow:hidden;">
								    <div id="manage_instance" class="cpu_contorl_1" style="float:left;">
									      <div class="cpu_contorl_1_1">实例数</div>
									      <div class="cpu_contorl_1_1" id="cpu_count" style="float:right;margin-right:80px;font-size:13px;"></div>
										  <div class="cpu_contorl_1_2">
											  <div class="progress_back" style="float:left;position:absolute;margin:5px 0px 0px 0px;">
											  	<div class="progress" style="position:absolute;width:200px;margin-top:4px;margin-left:10px;">
				     	 							<span class="blue" style="width:0%;"><span style="visibility:hidden;position:absolute;" ></span></span>
				    							</div>
				    							<div id="ins_transparent" style="position:absolute;width:200px;">
				     	 							<div style="width:0%;height:20px;margin-top:4px;margin-left:11px;border-right:2px solid red;"></div>
				    							</div>
				    						  </div>
										  </div>
										  <div class="cpu_contorl_1_3">
										      <div id="add_ins" class="cpu_contorl_1_3_1"></div>
											  <div id="minus_ins" class="cpu_contorl_1_3_2"></div>
										  </div>
									</div>
									<div id="manage_memory" class="cpu_contorl_1" style="float:left;margin-top:20px;">
									      <div class="cpu_contorl_1_1" style="width:100px;">每个实例内存</div>
									      <div class="cpu_contorl_1_1" id="cpu_count2"  style="float:right;margin-right:110px;font-size:13px;"></div>
										  <div class="cpu_contorl_1_2">
											  <div class="progress_back" style="float:left;position:absolute;margin:10px 0px 0px 0px;">
											  	<div class="progress" style="position:absolute;width:200px;margin-left:10px;">
				     	 							<span class="blue" style="width:0%;"><span  style="visibility:hidden;position:absolute;" ></span></span>
				    							</div>
				    							<div id="mem_transparent" style="position:absolute;width:200px;">
				     	 							<div style="width:0%;height:20px;margin-left:11px;border-right:2px solid red;"></div>
				    							</div>
				    						  </div>
										  </div>
										  <div class="cpu_contorl_1_3">
										      <div id="add_ins_mem" class="cpu_contorl_1_3_1"></div>
											  <div id="minus_ins_mem" class="cpu_contorl_1_3_2"></div>
										  </div>
										  <div class="clear"></div>
									</div>
								    <div class="cpu_contorl_1" >
								          <button id="confirm_cpu" style="float:left;" class="cpu_contorl_button">保存</button>
									</div>
									<div class="clear"></div>
								</div>
							</div>
							<!--<div class="managemen_menory_shuxian"></div>-->
					</div>
					<div class="maincontent">
						<div class="managemen_buttonlist left" style="width:17%">
			 			   <div id="app_detail" class="managemen_button managemen_button_select app_detail_select app_detail">
			 			   应用详情
			 			   </div>
						   <div id="app_serv" class="managemen_button app_serv">服务详情</div>
						   <div id="app_env" class="managemen_button app_env">环境变量</div>
						   <div id="app_code" class="managemen_button app_code">代码管理</div>
						   <div id="app_dom" class="managemen_button app_dom">域名管理</div>
						   <div id="app_status" class="managemen_button app_status">警报日志</div>
						   <div id="app_del" class="managemen_button app_del">删除应用</div>
						</div>
						<div class="mainlist_2 left" style="width:82%">
							
						</div>
					</div>

<script type="text/javascript" src="../js/DatePicker.js"></script>

<div class="servicemanage" style="display:none">
	
</div> 
<script>
//服务管理弹窗
$('.servicemanage').dialog({
	autoOpen:false,
    resizable: false,
    modal: true,
    width:700,
    position:[350,118],
    title:'manage'
});
//关闭弹窗
$(".push_close_1").live('click',function(){
	$('.servicemanage').dialog('close');
});
//显示服务管理弹窗
function showservicemanage(obj){
	var appid = $("#appId").html();
	var serviceName = $(obj).parent().parent().find("#serviceName").attr('namevalue');
	var sid = $(obj).parent().parent().find('#serviceId').attr("idvalue");
	var pagename=obj.id;
	var pname=pagename.toLocaleLowerCase();
	var urlpath="../servicemanage/"+pname+".jsp?sid="+sid+"&serviceName="+serviceName;
	var smid=appid+""+sid;
	$.ajax({
		url:urlpath,
		success : function(data) {
			$(".servicemanage").html("<div id='"+smid+"'>"+data+"</div>");
			if(pname=="mysql" || pname=="filesystem"){
				tis=$("#"+smid);
				getbar(pname,tis,sid);
			}
			if(pname!="asr" || pname!="tts" || pname!="hwr" || pname!="ocr" || pname!="face" || pname!="testin"){
				getenvlist(appid,sid);
				showServiceKeyInEnv(appid,sid);
			}
			if(pname == "asr"){
				pagename = '灵云能力';
			}
			$('.servicemanage').dialog("option","title",pagename+"("+serviceName+")").dialog('open');
		}
	});
}
//获取进度条数据
function getbar(type,tis,serId){
	var urlpath="";
	switch(type){
		case 'mysql': 
			urlpath="/service/getMysqlSize.json";break;
		case 'filesystem': 
			urlpath="/service/getFSCapacity.json";break;
		default:urlpath = "";
		break;
	}
	setbar(urlpath,tis,serId);
}
//设置进度条
function setbar(urlpath,tis,serId){
	$.ajax({
		url:urlpath,
		dataType : "json",
		data:{serviceId:serId},
		beforeSend:function(xhr){
			xhr.setRequestHeader('token',token);
		},
		success : function(data) {
			if(data.returnCode == "000"){
				tis.find('.push_1_cpty_3').html(data.usedSize+'/'+data.maxSize);
				var usedPercent = parseFloat(data.realUsedSize)/parseFloat(data.realMaxSize);
				tis.find('.push_1_cpty_2_1').css({'width':usedPercent*100+'%' , 'max-width':'100%'});
				if (usedPercent>=0.9){tis.find('.push_1_cpty_2_1').css('background-color','#ff0000');}
			}else{
				
			}
		}
	});
}
//获取服务对应的环境变量
function getenvlist(appid,serid){
	$(".envlist").html('<div class="gif_pic"><img src="../images/loading.gif"></div>');
	$.ajax({
		url:"../app/getServiceEnv.json?appId="+appid+"&serviceId="+serid,
	    dataType:"json",
	    async:false,
	    beforeSend: function(xhr){
	    	xhr.setRequestHeader('token', token);
	    },
	    success:function(data) {
	    	var elist="";
	    	if(data.returnCode=="901"){showMessageBox(data.returnMessage,1);}
	    	else if(data.list.length != 0){
    	        $.each(data.list, function(k, v) {
    	        	elist+='<div class="push_3_0">'
    	        		+'<div class="push_3_1">'+v.key+'</div>'
    	        		+'<div class="push_3_2" onclick="changestrSH(this)">显示</div>'
    	        		+'<div class="push_3_3" style="display:none">'+v.value+'</div>'
    	        		+'</div>';
    	        });
    	        $(".envlist").html(elist);
    	        if(data.code != undefined){
    	        	var _serviceEnv = new Object();
    	        	_serviceEnv.code = data.code;
    	        	_serviceEnv.appid = data.appId;
    	        	_serviceEnv.path = data.list[0].value+"/"+data.list[1].value;
    	        	$(".envlist").data("serviceEnv",_serviceEnv);
    	        }
	    	}
	    }
	});
}
//显示隐藏
function changestrSH(obj){
	var sstr='显示';
	var hstr='隐藏';
	var nextobj=$(obj).next().css("display");
	if(nextobj=="none"){
		$(obj).html(hstr);
		$(obj).next().attr("style","display:black");
	}else{
		$(obj).html(sstr);
		$(obj).next().attr("style","display:none");
	}
}
//only show serviceKey in env
function showServiceKeyInEnv(appid,serid){
	$("#showServiceKey").html('<div class="gif_pic"><img src="../images/loading.gif"></div>');
	$.ajax({
		url:"../app/getServiceEnv.json?appId="+appid+"&serviceId="+serid,
	    dataType:"json",
	    beforeSend: function(xhr){
	    	xhr.setRequestHeader('token', token);
	    },
	    success:function(data) {
	    	var elist="";
	    	if(data.returnCode=="901"){$("#showServiceKey").html(elist);}
	    	else if(data.list.length != 0){
    	        elist+='<div class="push_3_0">'
    	        	+'<div class="push_3_1">ServiceKey：'+data.list[0].key+'</div>'
    	        	+'<div class="push_3_2" onclick="changestrSH(this)">显示</div>'
    	        	+'<div class="push_3_3" style="display:none" id="servicekeyHide">'+data.list[0].value+'</div>'
    	        	+'</div>';
    	        $("#showServiceKey").html(elist);
	    	}
	    }
	});
}
</script>  
<script type="text/javascript">
//var token;
//获取appKey或者serviceKey
function getKey(serviceId,applicationId)
{
	var key;
	$.ajax({
		url:"/service/getServiceKey.json",
		async:false,
		type:"GET",
		dataType : "json",
		data : {appId:applicationId,serviceId:serviceId},
		beforeSend:function(xhr){xhr.setRequestHeader('token',token);},
		success : function(data){
			if(data.returnCode == "000"){
				key = data.serviceKey;	
			}
		}
	});
	return key;
}
//根据服务类型获取服务大图标
function getBigServIcon(type){
	img="../images/mopaas_pice/";
	switch(type){
		case 'Blob': img+='icon-blob-big.png';break;
		case 'Redis': img+='icon-redis-beta-big.png';break;
		case 'RabbitMQ': img+='icon-rabbitmq-beta-big.png';break;
		case 'MongoDB': img+='icon-mongodb-beta-big.png';break;
		case 'MySQL': img+='icon-mysql-big.png';break;
		case 'PostgreSQL': img+='icon-postgresql-beta-big.png';break;
		case 'FileSystem': img+='icon-file-big.png';break;
		case 'AndroidPush': img+='icon-android-big-beta.png';break;
		case 'iOSPush': img+='icon-ios-big-beta.png';break;
		case 'Social': img+='icon-social-big-beta.png';break;
		case 'Location': img+='icon-lbs-beta.png';break;
		case 'Scheduler': img+='icon-schedule-big.png';break;
		case 'MapReduce': img+='icon-mapreduce-big.png';break;
		case 'Memcached': img+='icon-memcached-big.png';break;
		case 'QiNiu': img+='icon-qiniu-big.png';break;
		case 'Push':img+='icon-push-big.png';break;
		//case 'Voice':img+='icon-voice-big.png';break;
		case 'asr':img+='hci80.png';break;
		//case 'asr':img+='asr80.png';break;
		//case 'tts':img+='tts80.png';break;
		//case 'hwr':img+='hwr80.png';break;
		//case 'ocr':img+='ocr80.png';break;
		case 'face':img+='face80.png';break;
		case 'Testin':img+='testin80.png';break;
		case 'upyun':img+='upyun80.png';break;
	}
	return img;
}
$(document).ready(function(){
	$.ajaxSetup({cache:false});
	
	//绑定/解绑服务
	$(".managemen_ser_bind_btn").live('click',function(){
		click_btn = $(this);
		bindSituation = $(this).attr("id");
		servId = $(this).parent().parent().find('#serviceId').attr("idvalue");
		urlpath = "";
		showMsg="";
		text = ""
		if(servId != null && applicationId != null){
			if(bindSituation == "unbind"){
				urlpath="/service/bindService.json";
				showMsg='绑定成功';
				text = '绑定';
			}else{
				urlpath="/service/unbindService.json";
				showMsg='解绑成功';
				text = '解绑';
			}
			$.ajax({
				url : urlpath,
				dataType : "json",
				type : "POST",
				data : {serviceId:servId,appId:applicationId},
				beforeSend : function(xhr){
					xhr.setRequestHeader('token',token);
					click_btn.attr('disabled',true);
					click_btn.css('cursor','default');
					click_btn.html(text+'中…');
				},
				success : function(data) {
					if(data.returnCode == '000'){
						showMessageBox(showMsg,0);
						$("#serv_list").html('');
						showServices();
					}else{
						showMessageBox(data.returnMessage,1);
						click_btn.removeAttr('disabled');
						click_btn.css('cursor','pointer');
						click_btn.html(text);
					}
				}
			});
		}
	});
	
	//管理数据库服务
	$("#management_db").live('click',function(){
		var serviceName = $(this).parent().parent().find("#serviceName").attr('namevalue');
		var sid = $(this).parent().parent().find('#serviceId').attr("idvalue");
		if(sid != null){
			window.open("../service/manageService.html?serviceId="+sid+"&serviceName="+serviceName);
		}
		return false;
	});
	
	//管理LBS服务
	$("#management_lbs").live('click',function(){
		var serviceName = $(this).parent().parent().find("#serviceName").attr('namevalue');
		sid = $(this).parent().parent().find('#serviceId').attr("idvalue");
		if(sid != null){
			window.open("../service/manageLBS.jsp?appID="+applicationId+"&serviceID="+sid+"&serviceName="+serviceName);
		}
		return false;
	});
	
	//管理社交插件服务
	$("#management_social").live('click',function(){
		var serviceName = $(this).parent().parent().find("#serviceName").attr('namevalue');
		sid = $(this).parent().parent().find('#serviceId').attr("idvalue");
		if(sid != null){
			window.open("../service/social.jsp?appID="+applicationId+"&serviceID="+sid+"&serviceName="+serviceName);
		}
		return false;
	});
	
	//管理安卓推送服务
	$("#management_android").live('click',function(){
		var serviceName = $(this).parent().parent().find("#serviceName").attr('namevalue');
		sid = $(this).parent().parent().find('#serviceId').attr("idvalue");
		if(sid != null){
			window.open("../service/androidpush.jsp?appID="+applicationId+"&serviceID="+sid+"&serviceName="+serviceName);
		}
		return false;
	});
	
	//管理ios推送服务
	$("#management_ios").live('click',function(){
		var serviceName = $(this).parent().parent().find("#serviceName").attr('namevalue');
		sid = $(this).parent().parent().find('#serviceId').attr("idvalue");
		if(sid != null){
			window.open("../service/iospush.jsp?appID="+applicationId+"&serviceID="+sid+"&serviceName="+serviceName);
		}
		return false;
	}); 
	
	//管理定时服务
	$("#management_schedule").live('click',function(){
		var serviceName = $(this).parent().parent().find("#serviceName").attr('namevalue');
		sid = $(this).parent().parent().find('#serviceId').attr("idvalue");
		serviceKey = getKey(sid,applicationId);
		window.open("../service/dingshi.jsp?serviceKey="+serviceKey+"&serviceName="+serviceName);
	}); 
	
	//管理mapreduce服务
	$("#management_mapreduce").live('click',function(){
		//var serviceName = $(this).siblings('#nameinfo').children("#serviceName").attr('namevalue');
		sid =  $(this).parent().parent().find('#serviceId').attr("idvalue");
		serviceKey = getKey(sid,applicationId);
		window.open("http://mapreduce.sturgeon.mopaas.com/mdps/mdps.html?serviceKey="+serviceKey);
	}); 
	
	//管理mapreduce服务
	$("#management_qiniu").live('click',function(){
		window.open("https://portal.qiniu.com/signin");
	}); 
	
	//监控lbs服务
	$("#monitor_lbs").live('click',function(){
		var serviceName = $(this).parent().parent().find("#serviceName").attr('namevalue');
		sid = $(this).parent().parent().find('#serviceId').attr("idvalue");
		serviceKey = getKey(sid,applicationId);
		window.open("../service/monitor_Location.jsp?serviceKey="+serviceKey+"&serviceName="+serviceName);
	});
	
	//监控社交服务
	$("#monitor_social").live('click',function(){
		var serviceName = $(this).parent().parent().find("#serviceName").attr('namevalue');
		sid = $(this).parent().parent().find('#serviceId').attr("idvalue");
		serviceKey = getKey(sid,applicationId);
		window.open("../service/monitor_Social.jsp?serviceKey="+serviceKey+"&serviceName="+serviceName);
	});
	
	//监控Android服务
	$("#monitor_android").live('click',function(){
		var serviceName = $(this).parent().parent().find("#serviceName").attr('namevalue');
		sid = $(this).parent().parent().find('#serviceId').attr("idvalue");
		serviceKey = getKey(sid,applicationId);
		window.open("../service/monitor_Android.jsp?serviceKey="+serviceKey+"&serviceName="+serviceName);
	});
	
	//监控IOS服务
	$("#monitor_ios").live('click',function(){
		var serviceName = $(this).parent().parent().find("#serviceName").attr('namevalue');
		sid = $(this).parent().parent().find('#serviceId').attr("idvalue");
		serviceKey = getKey(sid,applicationId);
		window.open("../service/monitor_IOS.jsp?serviceKey="+serviceKey+"&serviceName="+serviceName);
	});
	
	//点击菜单，改变导航
	$(".managemen_buttonlist .managemen_button").click(function(){
		$(".managemen_button_select").removeClass("managemen_button_select");
		removeSelectClass("app_detail_select","app_serv_select","app_env_select","app_code_select","app_dom_select","app_status_select","app_del_select");
		var id = $(this).attr("id");
		$(this).addClass(id+"_select");
		$(this).addClass("managemen_button_select");
	});
	
	
	
	//接收主页传送过来的ID
	$("#appId").html(getRequestParam("appID"));
	
	//获取应用信息
	appInfo = appInfo();
	imageType = getBigAppIcon(getRequestParam("appType"));
	$(".appinfo_1_1icon_inside").html("<img src="+imageType+">");
	//$("#appName").html(getCutString(appInfo["appName"],15));
	//$("#appName").attr("title",appInfo["appName"]);
	var uris=appInfo["uris"];
	var openUrl="";
	var uriss = "";
	if(uris != "uris" && uris!=""){
		var tempUrl = uris.split(",");
		openUrl = "http://"+tempUrl[tempUrl.length-1];
		uriss = tempUrl[0];
	}
	$(".appinfo_1_1url").html('<a href="'+openUrl+'" target="_blank">'+appInfo["appName"]+'</a>');
	$("#serviceCount").html(appInfo["totalService"]);
	$("#appState").html(appInfo['state']);
	$("#hide_app_mem").html(appInfo['appMem']);
	
	//判断应用状态
	if($("#appState").html()=="STOPPED"){
		$("#app_switch").addClass('manageApp_switch_off');
	}else{
		$("#app_switch").addClass('manageApp_switch_on');
	}
	
	//**************************管理用用内存和实例***********************************
	showTotalProgress(appInfo["leftMem"],appInfo["appMem"]);//总的内存条显示
	showProgressNum(appInfo["leftMem"],appInfo["appMem"]);//显示内存数字
	
	totalMem = appInfo["totalMem"]*1;//实例数
	insNum = appInfo["instances"]*1;//实例数
	appMem = appInfo["appMem"]*1;//当前应用使用内存
	leftMem = appInfo["leftMem"]*1;//此应用可用内存
	showProgressPotting(totalMem,leftMem,appMem,insNum,true);
	
	//显示管理内存
	 $("#manage_ins_mem").hover(function(){
		 	//var t=$(".managemen_menory").offset().top;
			//var l=$(".managemen_menory").offset().left;
			//$(".cpu_contorl").attr("style","left:"+l+"px;top:"+(t+40)+"px");
		 $(".managemen_menory_set").css("background","url(../images/mopaas_pice/chilun2.png)");
		 	$(".managemen_menory").css('border','1px solid #09f');
		 	$(".managemen_menory").css('border-radius','3px');
		 	$(".managemen_menory").css("border-bottom","0");
			$(".cpu_contorl").css("border-top","0");
			$(".cpu_contorl").css("display","block");
		},function(){
			 $(".managemen_menory_set").css("background","url(../images/mopaas_pice/chilun1.png)");
			$(".managemen_menory").css("border","0");
			$(".cpu_contorl").css("display","none");
	});
	
	//点击+-,管理实例和内存
	//实例加减1个，内存加减32M
	$("#add_ins").click(function(){
		addIns(appInfo["totalMem"]);
	});
	
	$("#minus_ins").click(function(){
		minusIns(appInfo["totalMem"])
	});
	
	$("#add_ins_mem").click(function(){
		addInsMem(appInfo["totalMem"]);
	});
	
	$("#minus_ins_mem").click(function(){
		minusInsMem(appInfo["totalMem"]);
	});
	
	//提交修改的实例数和内存数
	$("#confirm_cpu").live('click',function(){
		progressInfo = getProgressInfo();
		insNum = progressInfo["nowInsNum"];
		applicationId = $("#appId").html();
		appMem = progressInfo["nowappMem"];
		InsMem = progressInfo["nowInsMem"];
		$.ajax({
			url : "/app/modifyApp.json",
			dataType : "json",
			type : "POST",
			data : {instances:insNum,appId:applicationId,memory:InsMem},
			beforeSend : function(xhr){
				xhr.setRequestHeader('token',token);
				$("#confirm_cpu").attr('disabled',true);
				$("#confirm_cpu").css('cursor','default');
			},
			success : function(data) {
				$("#confirm_cpu").attr('disabled',false);
				$("#confirm_cpu").css('cursor','pointer');
				if(data.returnCode == '000'){
					$(".cpu_contorl").css("display","none");
					showMessageBox('内存管理调节成功',0);
					setTimeout(window.location.reload(),10000); 
				}else{
					showMessageBox(data.returnMessage,1);
				}
			}
		});
	});
	
	//默认显示应用详情************************************************
	showInfo("monitorApp.jsp");
	
	//显示应用详情
	$("#app_detail").click(function(){
		showInfo("monitorApp.jsp");
	});
	
	//显示服务
	$("#app_serv").click(function(){
		showInfo("../service/service.jsp");
	});
	
	//显示域名管理
	$("#app_dom").click(function(){
		showInfo("../app/domApp.jsp");
	});
	//环境变量
	$("#app_env").click(function() {
		showInfo("../service/env.jsp");
	});
	
	//代码管理
	$("#app_code").click(function() {
		showInfo("../service/code.jsp");
	});
	//健康状态
	$("#app_status").click(function() {
		showInfo("statusApp.jsp");
	});
	
	//删除应用
	$("#app_del").click(function(){
		showInfo("delApp.jsp");
	});
		
	//开启关闭应用
	$(".managemen_switch").click(function(){
		var applicationid = $("#appId").html();
		var appstate = $("#appState").html();
		var self = $(this);
		clickOnOrOff(appstate, applicationid, self);
	});
});

function removeSelectClass(){
	var argu = arguments;
	for(var i=0;i<argu.length;i++){
		if($("."+argu[i]) != 'undefined'){
			$("."+argu[i]).removeClass(argu[i]);			
		}
	}
}

function clickOnOrOff(appstate, applicationid, self){
	if(appstate!=null && applicationid!=null){
		var ajax_url;
		var remove_class;
		var add_class;
		var next_appstate;
		var success_info;
		switch(appstate){
			case "STOPPED":
				next_appstate = "STARTED";
				ajax_url = "/app/startApp.json";
				remove_class = "manageApp_switch_off";
				add_class = "manageApp_switch_on";
				success_info = '应用开启成功';	
			break;
			case "STARTED":
				next_appstate = "STOPPED";
				ajax_url = "/app/stopApp.json";
				remove_class = "manageApp_switch_on";
				add_class = "manageApp_switch_off";
				success_info = '应用关闭成功';
			break;
		}
		$.ajax({
			url:ajax_url,
			dataType : "json",
			type:"POST",
			data:{appId:applicationid},
			beforeSend:function(xhr){
				xhr.setRequestHeader('token',token);
				self.attr('disabled',true);
			},
			success : function(data) {
				if( data.returnCode== "000"){
					$("#appState").html(next_appstate);
					self.removeClass(remove_class);
					self.addClass(add_class);
					showMessageBox(success_info,0);
				}else{
					showMessageBox(data.returnMessage,1);
				}
			},
			complete :function(XMLHttpRequest, textStatus){
				self.removeAttr('disabled');
			}
		});							
	}
}


function showInfo(urlpath){
	$.ajax({
		url:urlpath,
		success : function(data) {
			$(".mainlist_2").html(data);
		}
	});
	
}

//显示总内存进度条
function showTotalProgress(leftMem,appMem){
	totalMemPercent = appMem/leftMem*100;
	if(totalMemPercent>=100){
		$(".managemen_menory .progress  #total_mem").animate({width:"100%"});
		$(".managemen_menory  .progress #total_mem").css("display","block");
		$(".managemen_menory  .progress #total_mem").addClass("red").removeClass("blue");
	}else{
		if(totalMemPercent > 0){
			$("#total_mem").addClass("blue").removeClass("none");
			$("#fix_total_mem").addClass("light_blue").removeClass("none");
		}
		$(".managemen_menory .progress  #total_mem").animate({width:totalMemPercent+"%"});
		$(".managemen_menory .progress #fix_total_mem").animate({width:totalMemPercent+"%"});
	}
}

//显示中内存数
function showProgressNum(leftMem,appMem){
	$(".managemen_menory #display_mem_num").html(appMem+"/"+leftMem);
	$(".managemen_menory #display_mem_num_show").html(appMem+"M/"+leftMem+"M");
}


//显示总内存调节是内存差
function showFixProgress(leftMem,appMem,action){
	realAppMem = $("#hide_app_mem").html()*1;
	totalMemPercent = appMem/leftMem*100;
	fixPercent = realAppMem/leftMem*100;
	
	/* if(appMem > realAppMem){
		if(action == "add"){
			$(".managemen_menory .progress #total_mem").css("width",fixPercent+"%");
		}
		$(".managemen_menory .progress #fix_total_mem").css("width",totalMemPercent+"%");
	}else {
		if(action == "minus"){
			$(".managemen_menory .progress #fix_total_mem").css("width",fixPercent+"%");
		}
		$(".managemen_menory .progress #total_mem").css("width",totalMemPercent+"%");
	} */
	if(totalMemPercent>=100){
		$(".managemen_menory .progress  #fix_total_mem").animate({width:"100%"});
		//$(".managemen_menory .progress  #fix_total_mem").addClass("red").removeClass("light_blue");
	}else{
		$(".managemen_menory .progress #fix_total_mem").animate({width:totalMemPercent+"%"});
		$(".managemen_menory .progress  #fix_total_mem").removeClass("red").addClass("light_blue");
		if(appMem < realAppMem){
			$(".managemen_menory .progress #fix_total_mem").css("z-index","5");
			$(".managemen_menory .progress #total_mem").css("z-index","3");
		}else{
			$(".managemen_menory .progress #fix_total_mem").css("z-index","3");
			$(".managemen_menory .progress #total_mem").css("z-index","5");
		}
	}
}


//显示管理实例内存进度条
function showProgress(totalMem,leftMem,appMem,insNum,isInit,insMixMem){
	insMem = parseInt(appMem/insNum); //当前实例内存
	
	//totalInsNum = parseInt(totalMem/insMem);
	totalInsNum = parseInt(leftMem/insMixMem);
	//canAddIns = parseInt(leftMem/insMem); //当前可以增加的实例总数
	
	//totalInsMem = parseInt(totalMem/insNum);//根结总内存计算出所有的实例内存
	insBMem = parseInt(leftMem/insNum); //每个实例最大可用内存
	
	insPercent = insNum/totalInsNum*100;
	//canAddInsPercent = canAddIns/totalInsNum*100;
	canAddInsPercent = insMixMem/insMem*100;
	
	insMemPercent = insMem/totalMem*100;
	insBMemPercent = insBMem/totalMem*100;
	
	if(isInit == true){
		$("#manage_instance .progress .blue").animate({width:insPercent+"%"});
		$("#manage_instance .progress .blue span").html(insNum);
		$("#cpu_count").html(insNum);
	}
	$("#ins_transparent div").animate({width:canAddInsPercent+"%"});
	
	
	$("#manage_memory .progress .blue").animate({width:insMemPercent+"%"});
	$("#mem_transparent div").animate({width:insBMemPercent+"%"});
	$("#manage_memory .progress .blue span").html(insMem);
	$("#cpu_count2").html(insMem+"M");
	
}

function showProgressPotting(totalMem,leftMem,appMem,insNum,isInit){
	var appType = getRequestParam("appType");
	var insMixMem = 64;
	if(appType == "java_web" || appType == "spring"){
		insMixMem = 256;
	}
	showProgress(totalMem,leftMem,appMem,insNum,isInit,insMixMem);
}

//获取当前实例内存信息
function getProgressInfo(){
	memHtml = $(".managemen_menory  #display_mem_num").html();
	insHtml = $("#manage_instance .progress .blue span").html();
	insMemHtml = $("#manage_memory .progress .blue span").html();
	var progressInfo = new Array();
	progressInfo["nowappMem"] = memHtml.split("/")[0];
	progressInfo["nowleftMem"] = memHtml.split("/")[1];
	progressInfo["nowInsNum"] = insHtml;
	progressInfo["nowInsMem"] = insMemHtml;
	return progressInfo;
}



//获取用户的信息
/*function getUserInfo(){
	$.ajax({
		 url:"/user/getUser.json",
		 dataType:"json",
		 beforeSend: function(xhr){xhr.setRequestHeader('token', token);},
    	 success:function(data) {
		 	$("#email").html(data.email);
    	}
	});
}*/

//获取应用总信息
function appInfo(){
	var currentPage = getRequestParam("page");
	var appInfo = new Array();
	otherAppMem = 0;
   	$.ajax({
   			url:"/app/listApp.json?currentPage="+currentPage+"&pageSize=30",
    	    dataType:"json",
    	    beforeSend: function(xhr){
    	    	xhr.setRequestHeader('token', token);
    	    	$(".mainlist_2").html("<div class='gif_pic'><img src='../images/loading.gif'></div>");
    	    },
    	    async:false,
    	    success:function(data) {
    	    	appInfo['totalMem'] = data.memCount;
    	    	appInfo['totalService'] = data.serviceCount;
    	        $.each(data.list, function(k, v) {
    	        	if($("#appId").html() == v.id){
    	        		appInfo['appName'] = v.appName;
    	        		appInfo['uris'] = v.uris;
    	        		appInfo['state'] = v.state;
    	        		appInfo['insMem'] = v.memory;
    	        		appInfo['instances'] = v.instances;
    	        		appInfo['appMem'] = v.memory*1*v.instances;
    	        	}else{
    	        		if(v.state=="STARTED"){
    	        			otherAppMem = otherAppMem*1 + v.memory*1*v.instances;;
    	        		}
    	        	}
    	        });
    	        appInfo['otherMem'] = otherAppMem;
    	        appInfo['leftMem']= data.memCount*1-otherAppMem*1;
    		}
   	});
   	return appInfo;
}

//增加实例
function addIns(totalMem){
	progressInfo = getProgressInfo();
	
	leftMem = progressInfo["nowleftMem"]*1;//应用总可用内存
	appMem = progressInfo["nowappMem"]*1;
	canUseMem = leftMem - appMem;
	nowInsNum = progressInfo["nowInsNum"]*1;//当前实例数
	nowInsMem = parseInt(appMem/nowInsNum);//当前实例内存
	
	if(nowInsMem <= canUseMem){//增加一个实例，当增加实例内存<=剩余可用内存时
		nowInsNum = nowInsNum+1;
		usedMem = appMem*1+nowInsMem*1;
		showProgressNum(leftMem,usedMem);
		showFixProgress(leftMem,usedMem,"add");
		showProgressPotting(totalMem,leftMem,usedMem,nowInsNum,true);
	}
}

//减少实例
function minusIns(totalMem){
	progressInfo = getProgressInfo();
	
	leftMem = progressInfo["nowleftMem"]*1;//应用总内存
	appMem = progressInfo["nowappMem"]*1;
	nowInsNum = progressInfo["nowInsNum"]*1;//当前实例数
	nowInsMem = parseInt(appMem/nowInsNum);//当前实例内存
	
	if(nowInsNum > 1){
		nowInsNum = nowInsNum-1;
		usedMem = appMem-nowInsMem;
		showProgressNum(leftMem,usedMem);
		showFixProgress(leftMem,usedMem,"minus");
		showProgressPotting(totalMem,leftMem,usedMem,nowInsNum,true);
	}
}

//增加实例内存,增加单位64M
function addInsMem(totalMem){
	progressInfo = getProgressInfo();
	
	leftMem = progressInfo["nowleftMem"]*1;//应用总内存
	appMem = progressInfo["nowappMem"]*1;
	canUseMem = leftMem - appMem;
	nowInsNum = progressInfo["nowInsNum"]*1;//当前实例数
	addInsMemory = nowInsNum*64;//增加的总内存
	if(addInsMemory <= canUseMem){
		usedMem = appMem+addInsMemory;
		showProgressNum(leftMem,usedMem);
		showFixProgress(leftMem,usedMem,"add");
		showProgressPotting(totalMem,leftMem,usedMem,nowInsNum,false);
	}
}

//减少实例内存，减少单位64M
function minusInsMem(totalMem){
	progressInfo = getProgressInfo();
	
	leftMem = progressInfo["nowleftMem"]*1;//应用总内存
	appMem = progressInfo["nowappMem"]*1;
	nowInsNum = progressInfo["nowInsNum"]*1;//当前实例数
	minusInsMemory = nowInsNum*64;//增加的总内存
	
	var _mixMem = (getRequestParam("appType") == "java_web" || getRequestParam("appType") == "spring")?(nowInsNum*256):nowInsNum*64;
	if(_mixMem < appMem){
		usedMem = appMem-minusInsMemory;
		showProgressNum(leftMem,usedMem);
		showFixProgress(leftMem,usedMem,"minus");
		showProgressPotting(totalMem,leftMem,usedMem,nowInsNum,false);
	}
}

//获取应用类型的图标    
 function getBigAppIcon(type){
	img="../images/mopaas_pice/";
	switch(type){
		case 'rails3': img+='icon-ror.png';break;
		case 'spring': img+='icon-java-spring.png';break;
		case 'grails': img+='icon-java-grails.png';break;
		case 'java_web': img+='icon-javaweb.png';break;
		case 'sinatra': img+='icon-sinatra.png';break;
		case 'node': img+='icon-node.png';break;
		case 'php': img+='icon-php.png';break;
		case 'wsgi': img+='icon-python-wsgi.png';break;
		case 'rack': img+='icon-rack-big.png';break;
		case 'play': img+='icon-play-big.png';break;
	}
	return img;
}

</script>

	

<div class="home_footer">
     <div class="home_footer_1">	 
	   		<div id="contact" class="home_main_3" style="height:30px;">
			      <div class="home_main_3_1">
			      		<div class="home_main_3_1_2_1">电话：400-001-5592&nbsp;&nbsp;邮箱：mopaas@anchora.me</div>
 						<div class="home_main_3_1_2_1" style="">浙ICP备12032155号 ? Anchora,Inc. All Rights Reserved.&nbsp;&nbsp;<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=2629198267&site=qq&menu=yes"><img style="vertical-align: middle;" border="0" src="../images/mopaas_pice/qq_zh-CN.png" alt='在线客服' title='在线客服'/></a></div>
				  </div>
				  <div style="height:auto;float:right;">
						  <div class="home_main_3_3">
						       <div class="home_main_3_1_3_1" id="en_div"><a onclick="location.href='/change.html?locale=en&url='+encodeURIComponent(location.href)" style="text-decoration:none;">English</a></div>
						       <div class="home_main_3_1_3_1" id="zh_div"><a onclick="location.href='/change.html?locale=zh_CN&url='+encodeURIComponent(location.href)" style="text-decoration:none;">中文</a></div>
						  </div>
						  <div class="home_main_3_2">
						       <div class="home_main_3_1_2" onclick="location.href='../aboutus.jsp';">关于我们</div>
						       <div class="home_main_3_1_2" onclick="location.href='../serviceterm.jsp';">服务条款</div>
							   <div class="home_main_3_1_2" onclick="location.href='../private.jsp'" style="border:none;" >隐私申明</div>
							  <!-- <div class="home_main_3_1_2" onclick="location.href='../commonproblem.jsp'" style="border:none;">常见问题</div>  -->
						  </div>
				  </div>
			</div>
			<div id="languageLocale" style="display:none">zh-CN</div>
	 </div>
</div>
</body>
</html>
 <script type="text/javascript">
 checkLanguageEnv("zh-CN");
	var useremail;
	$(document).ready(function(){
		$.ajaxSetup({cache:false});
		var uid = getCookie("uid");
		if(uid!=null){
			getUserInfoBySan();
		}else{
			getUserInfo(); 
		}
		getUnreadRemindCount();
		
	});
	
		//第三方登陆情况下获取用户信息
		function getUserInfoBySan(){
			useremail = getCookie("email");
			nickname = getCookie("nickname");
			$("#email").html(nickname);
		}
 
		 //获取用户的信息
	    function getUserInfo()
	    {
	    	$.ajax({
	    		 url:"/user/getUser.json",
	    		 dataType:"json",
	    		 async:false,//necessary
	    		 beforeSend: function(xhr){xhr.setRequestHeader('token', token);},
		    	 success:function(data) {
		    		 useremail=data.email;
		    		 $("#email").html(getCutString(useremail.split('@')[0],11));
		    		 var len = $("#email").html().length;
		    		 var padding ;
		    		 if(len<8&&len>3){
		    			 padding = (120-len*5)/2;
		    		 }else if(len>=8 && len<10){
		    			 padding = 10;
		    			 $("#userInfo").css('width',"150px"); 
		    		 }else if(len <= 3){
		    			 padding =45;
		    		 }else{
		    			 $("#login_info").css('width',"200px");
		    			 $("#userInfo").css('width',"190px"); 
		    		 }
		    		 
		    		 
		    		 //$("#login_info").css("width",150+padding);
		    		 $("#userInfo").css("padding-left",padding);
		    		 $('#userInfo').attr('title',useremail.split('@')[0]);
		    	}
	    	});
	    }
		 
	    
	    
	    $(".applicationlist_button_1").live('click',function(){
			$(".applicationlist_button_1").css("background","#eeeeee");
			$(".applicationlist_button_1").css("color","#808080");
			$(this).css("background","#2C86C2");
			$(this).css("color","#FFFFFF");
		});
  
		//移至用户邮箱 下拉
		$("#login_info").hover(function(){
			$("#operate_list").show();
		//	$("#userInfo").addClass("user_list_name_selected");
		},function(){
		//	$("#userInfo").removeClass("user_list_name_selected");
			$("#operate_list").hide();
		});

	    $("#logout").click(function(){
	    	$.ajax({
	    		 url:"/user/logout.json",
	    		 dataType:"json",
	    		 beforeSend: function(xhr){xhr.setRequestHeader('token', token);},
		    	 success:function(data) {
	    		 		location.href = "../login.jsp";
		    	},
	    		complete: function(XMLHttpRequest, textStatus){       
	    			$.cookie("token", null, { path: '/' });
	    			$.cookie("login", null, { path: '/' });
	    			$.cookie("uid", null, { path: '/' });
	    			$.cookie("nickname", null, { path: '/' });
	    			$.cookie("email", null, { path: '/' });

	 	   		}
	    	});
	    });
	    
	    $("#modifyPwd").click(function(){
	    	location.href = "../user/modifyPasswd.jsp";
	    });	  
	    
//	    (function(){
	    	var int=setInterval("getUnreadRemindCount()",60000);
	    	function getUnreadRemindCount(){
	    		var data = {currentPage:1,pagesize:6};

	    		$.ajax({
	    			url:"/user/getRemindsList.json",
	    			type:"post",
	    			data:data,
	    			dataType:"json",
	    			beforeSend: function(xhr){
	    				xhr.setRequestHeader('token', token);
	    			},
	    			success:function(data){
	    				if(data.returnCode == "000"){
	    					if(data.unreadcount >= 0){
	    						show_remind_num(data.unreadcount)
	    					}else{
	    						$("#setAllHaveRead").html('无未读信息');
	    					}
	    				}else{
	    					showMessageBox(data.returnMessage,1);
	    				}
	    			}
	    		});	
	    	}
	    	
	    	function show_remind_num(num){
	    		if(num == 0)
	    		{
	    			$("#remind_img").attr("src","../images/haveNoMessage.png");
	    			$("#remind_img_num").html('');
	    			$("#setAllHaveRead").html('无未读信息');
	    		}
	    		else
	    		{
	    			$("#remind_img").attr("src","../images/haveMessage.png");
		    		if(num>10){
		    			$("#remind_img_num").html("N");
		    		}
		    		else{
		    			$("#remind_img_num").html(num);
		    		}
	    		}
	    		
	    	}
	    	
	    	function remindInMaintenance(){
	    		showMessageBox('站内提醒功能正在维护中...',1);
	    	}
	    	function tabSwitch(tabname,classname){
	    		$(".tab").hide();
	    		$(".btnfortab").removeClass(classname);
	    		$("#btn_"+tabname).addClass(classname);
	    		$("#table_"+tabname).show();
	    	}
	    	/** 分页方法集成
	    	 * Create the select HTML DOM in the paging function
	    	 * dialog_count:The total number of all information
	    	 * index:The number of pages to be displayed
	    	 * pagesize:The number of entries displayed one page
	    	 * callback:The callback function is used to query information
	    	 */
	    	function createPaymentSelectHTML(dialog_count,index,pagesize,callback,isPageCount){
	    		var _dialog_count = 0;
	    		if(isPageCount == true){
	    			_dialog_count = dialog_count
	    		}else{
	    			_dialog_count = Math.ceil(dialog_count/pagesize);
	    		}
	    		$("#dialogTotalPage").text(_dialog_count);
	    		var select_html_str = "<select id='dialog_current_page' style='height:20px;margin-top:4px;'>";
	    		for(var i=1;i<=_dialog_count;i++){
	    			if(index == i){
	    				select_html_str += "<option value='"+i+"' selected='selected'>"+i+"</option>";	
	    			}else{
	    				select_html_str += "<option value='"+i+"'>"+i+"</option>";	
	    			}
	    		}
	    		select_html_str += "</select>";
	    		$("#dialog_current_page_select").html(select_html_str);
	    		
	    		$("#dialog_current_page").change(function(){
	    			var currentPage = $(this).val();
	    			callback(currentPage,pagesize);
	    		});
	    	}
	    	/**
	    	 * Create the Html DOM to the paging function and bind related events
	    	 */
	    	function createAndBindPageTurning(div_id,callback,pagesize){
	    		createPageTurningHTML(div_id);
	    		bindDialogPageClick(callback,pagesize);
	    	}
	    	function createPageTurningHTML(div_id){
	    		var pageTurningHTML = '<div id="service_manage_note_page_turning" style="float:right;width:auto; height:20px;margin-top:10px;">';
	    		pageTurningHTML += '<div id="dialog_first_page"  class="time_service_journal_title_page_1"  title="第一页"></div>';
	    		pageTurningHTML += '<div id="dialog_last_page"  class="time_service_journal_title_page_2"  title="前一页"></div>';
	    		pageTurningHTML += '<div id="dialog_current_page_select" style="float:left;width:40px;"></div>';
	    		pageTurningHTML += '<div style="float:left;min-width:45px; hegiht:20px; line-height:28px; font-size:16px;">/<span id="dialogTotalPage"></span>页</div>';
	    		pageTurningHTML += '<div id="dialog_next_page"  class="time_service_journal_title_page_4"  title="下一页"></div>';
	    		pageTurningHTML += '<div id="dialog_end_page"  class="time_service_journal_title_page_5"  title="最后一页"></div>';
	    		pageTurningHTML += '</div>';
	    		$("."+div_id).after(pageTurningHTML);
	    	}
	    	function bindDialogPageClick(callback,pagesize){
	    		if(pagesize == undefined){
	    			pagesize = 10;
	    		}
	    		$("#dialog_first_page").click(function(){
	    			callback(1,pagesize);
	    		});
	    		$("#dialog_last_page").click(function(){
	    			var current_dialog_page = new Number($("#dialog_current_page").val());
	    			var last_page = current_dialog_page-1;
	    			if(last_page < 1){
	    				showMessageBox("目前已是首页",1);	
	    			}else{
	    				callback(last_page,pagesize);
	    			}
	    		});
	    		$("#dialog_next_page").click(function(){
	    			var current_dialog_page = new Number($("#dialog_current_page").val());
	    			var total_dialog_page = new Number($("#dialogTotalPage").text());
	    			var next_page = current_dialog_page+1;
	    			if(next_page >total_dialog_page){
	    				showMessageBox("目前已是末页",1);	
	    			}else{
	    				callback(next_page,pagesize);
	    			}
	    		});
	    		$("#dialog_end_page").click(function(){
	    			var total_dialog_page = $("#dialogTotalPage").text();
	    			callback(total_dialog_page,pagesize);
	    		});
	    	}	
	    	
	    	function checkSMSauthor(){
	    		var url_path="http://message.sturgeon.mopaas.com/";
	    		$.ajax({
	    			url:url_path+"/message/api/authorizestatus?jsonpCallback=?",
	    			type:'post',
	    			data:{userMail:useremail},
	    			dataType:'json',
	    			beforeSend: function(xhr){xhr.setRequestHeader('token', token);},
	    			success:function(data){
	    				if(data.resultCode == "0" || data.resultCode == 0){
		    				window.location.href='../sms/msgservice.jsp';
	    				}else{
	    					showMessageBox('您尚未授权或服务关闭，具体请联系客服短信授权',1);
	    				}
	    			},            
    				error : function(xhr) {
    	            	showMessageBox('您尚未授权或服务关闭，具体请联系客服短信授权',1);
    	            }
	    		});
	    	}
	    	function getUnameCookie(name) {	//name为cookie名称
	    		var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
	    	    if(arr != null) {
	    	    	return arr[2];
	    	    } else {
	    	    	return null;
	    	    }
	    	}
	    	
</script> 